package me.pplay.playtalk.adapter;

import java.util.ArrayList;
import java.util.List;

import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;

public class MyPagerAdapter extends PagerAdapter{
	private List<View> mViews;
	
	public MyPagerAdapter(List<View> views){
		if(views == null)
			mViews	= new ArrayList<View>();
		else
			mViews	= views;
	}

	@Override
	public void destroyItem(View v, int position, Object obj) {
		((ViewPager)v).removeView(mViews.get(position));
	}

	@Override
	public void finishUpdate(View arg0) {
		
	}

	@Override
	public int getCount() {
		return mViews.size();
	}

	@Override
	public Object instantiateItem(View v, int position) {
		((ViewPager)v).addView(mViews.get(position));
		return mViews.get(position);
	}

	@Override
	public boolean isViewFromObject(View arg0, Object arg1) {
		return arg0 == arg1;
	}

	@Override
	public void restoreState(Parcelable arg0, ClassLoader arg1) {
		
	}

	@Override
	public Parcelable saveState() {
		return null;
	}

	@Override
	public void startUpdate(View arg0) {
		
	}
}
